<template>
  <div class="foodHotPot">
    <hot-pot-header/>
    <hot-pot-logo/>
    <hot-pot-recommend :list="hotPotRecommendList "/>
    <hot-pot-footer/>
  </div>
</template>

<script>
import HotPotHeader from "./components/HotPotHeader.vue";
import HotPotLogo from "./components/HotPotLogo.vue";
import HotPotRecommend from "./components/HotPotRecommend.vue";
import HotPotFooter from "./components/HotPotFooter.vue";
import axios from "axios";
export default {
  name: "foodHotPot",
  components: {
    HotPotHeader,
    HotPotLogo,
    HotPotRecommend,
    HotPotFooter
  },
  data: function() {
    return {
      hotPotRecommendList: []
    };
  },
  mounted() {
    this.getHomeApiInfo();
  },
  methods: {
    getHomeApiInfo() {
      axios
        .get("/mock/Food/hotPot.json")
        .then(this.getHomeResponseInfo, function(success) {
          console.log("请求json数据成功");
          console.log(success);
        })
        .catch(function(err) {
          console.log("请求json数据失败");
          console.log(err);
        });
    },
    getHomeResponseInfo(response) {
      console.log(response.data);
      let res = response.data;
      if (res.success && res.dataList) {
        const hotPotData = res.dataList;
        this.hotPotRecommendList = hotPotData.HotPotRecommedLists;
      }
    }
  }
};
</script>          